package droid.frame.service;

import android.annotation.SuppressLint;
import android.app.Service;
import android.content.Intent;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.support.annotation.Nullable;

import droid.frame.utils.android.Alert;

/**
 * Created by joker on 2018/5/9.
 */
@SuppressLint("NewApi")
public class BaseService extends Service implements Handler.Callback {


    @Override
    public void onCreate() {
        super.onCreate();
        ServiceMgr.push(this);
    }

    @Override
    public boolean handleMessage(Message msg) {
        return false;
    }

    /**
     * 项目中用到的通用toast<br>
     * 子类可以根据需要重载覆盖
     */
    public void showToast(final String message) {
        Alert.toast(message);
    }

    public void showToast(final int message) {
        Alert.toast(message);
    }

    @Override
    public void onDestroy() {
        ServiceMgr.remove(this);
        super.onDestroy();
    }

    @Nullable
    @Override
    public IBinder onBind(Intent intent) {
        return null;
    }
}
